package com.zhc.dejingapi.utils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhc.dejingapi.entity.RealtimeEntity;
import com.zhc.dejingapi.service.RealtimeService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author zhc
 * @date 2024年07月27日 14:05
 */
@Component
public class InitUtil {

    @Resource
    private RealtimeService realtimeService;
    public void addInit(Long eId){
            QueryWrapper<RealtimeEntity> realtimeQueryWrapper = new QueryWrapper<>();
            realtimeQueryWrapper.eq("e_id",eId);
            long one = realtimeService.count(realtimeQueryWrapper);
            if(one <=0) {
                RealtimeEntity realtime = new RealtimeEntity();
                realtime.setId(eId);
                realtime.setEId(eId);
                realtime.setSts(0);
                realtimeService.save(realtime);
            }
    }
}
